/*
 * MIT License
 *
 * Copyright (c) 2024 Bamboo
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */

package mock

import (
	"log"
	"sync"

	"github.com/GoSimplicity/AI-CloudOps/internal/model"
	"gorm.io/gorm"
)

type K8sClientMock struct {
	sync.RWMutex
	db *gorm.DB
}

func NewK8sClientMock(db *gorm.DB) *K8sClientMock {
	mock := &K8sClientMock{
		db: db,
	}

	mock.populateMockData()

	return mock
}

// populateMockData 插入多个模拟集群和相关数据到数据库
func (m *K8sClientMock) populateMockData() {
	m.Lock()
	defer m.Unlock()

	// 检查是否已经初始化过集群
	var count int64
	m.db.Model(&model.K8sCluster{}).Count(&count)
	if count > 0 {
		log.Println("[K8s集群已经初始化过,跳过Mock]")
		return
	}

	log.Println("[K8s集群Mock开始]")

	clusters := []model.K8sCluster{
		{
			Name:          "Cluster-1",
			NameZh:        "集群-1",
			UserID:        1,
			CpuRequest:    "100m",
			CpuLimit:      "200m",
			MemoryRequest: "256Mi",
			MemoryLimit:   "512Mi",
			Env:           "prod",
			Version:       "v1.32.0",
			ApiServerAddr: "https://api.cluster1.example.com",
			KubeConfigContent: `
apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJSVVvMDZCMEplSFl3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBNU16QXdPREEyTWpkYUZ3MHpOREE1TWpnd09ERXhNamRhTUJVeApFekFSQmdOVkJBTVRDbXQxWW1WeWJtVjBaWE13Z2dFaU1BMEdDU3FHU0liM0RRRUJBUVVBQTRJQkR3QXdnZ0VLCkFvSUJBUUREOW02ZWZQQytMazZ2clkwVEUyMVJieU9WZGMvVmR3c0FMZ011ci9zMlR0MzVYV2I4aFczT3lrQTEKNEVPYWQ5VmNrNExnK1VnMXdDV1ozMTNPbnFmRUFEQ25OWjFiRHJGbCs0Smhya2c4M0pUanlPZStqZmdNOXFWTQptczVoSjhnT3didmQ2WmdaOFl2bHowbHZGU3hEZGdHNXhIZGdqemZYU0FMRlhIS1hweVpWbHpqaWNWT1FNRWlrClM3clBoQUEyTnNLdDljeFVHUkI1OUMzN3poNks5MjdFclNJbUlKalZ0Ynl4MXJaVnBFSW1STGRPcFI2NWZlYnoKU2h6UlVwejVxTGMxZjl5TWlnWVRFY2tRZHFlYXFJYi9aQ1RTWmw3d09ZcHJIT3NianJaR21WN243QkVGU3lsUgplYzcvalRQWTFya3JLaEw2ZWJCeVBEWm1MckJQQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJReUp2SWYremlBQ0xlYzZlUkxvbU5IdG5SUkNqQVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQ1o5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XdDVG9seGlETkJnTzZLZVJidEYyTWJLc0VxWTBrc3A5CkpnNm0xdUxUZEk2YTlTZ00yVUc1YUJZSzR5MTJ0WWFtY2pmVVZiSGxkR3lQNU9YeDY4RDNFNnI5NHhVUFVjR2kKc3BFekxMZkZQWnFmZGg3bDJjUEtnY3BiV1FPRklva0dKaGVJT1lPZ3pFOFZpbG0wS1dBbmhwWkFkQXZIbnVwRApNaUpHaSt1ejRTejJ3N2dJRzZPeXA1MkVyODVmQWdNQkFBR2pXVEJYTUE0R0ExVWREd0VCL3dRRUF3SUNwREFQCkJnTlZIUk1CQWY4RUJUQURBUUgvTUIwR0ExVWREZ1FXQkJSdGpIa0trL0I2bVRsNUc4ZFJMZEFReVN3QlRqQVYKQmdOVkhSRUVEakFNZ2dwcmRXSmxjbTVsZEdWek1BMEdDU3FHU0liM0RRRUJDd1VBQTRJQkFRQ2R4WDE4VWhiTgpBcnE2UVg2K1B6WEFTS2FWWFBsWVNxV3VTS1dYUm1ZTjhvTnJZenpMZGZ0TGxmbWExWUZqaFpKaDY5Z2dTUlZ5CjlQTGU0OHRETDhFSDVMNFFOTDAwL2tZcThyaEtGei9lVC9TY1dITUMyUGZKaHM2Q3B5QzVtS3h5b0JGTE9rZlQKQ2hVOTlIalhkU0NmUmw1TXpGQWdSRVpQWWhhVHRRQWR5clZvcTdSUXZ2aFNWcVBBTmNobWJtMU5aVGIrVjhYSgo3SzFQUngrVmoraEFCRXhuSGR6d1BsYUdUVTJ0cjJUSTNGRjhkejZPdTVuV3E3aEdiNUl5Vk9RZ09QdHh0MW9UCko4ZG5aU0RDNWxjVnZtRzVQdElHcFFtYVkwMWtzMC8xejQ5ZXhEbllwb3dYMlhXZWk2eW5MU08wOEpjUHJKSHYKTGY2MlpQQUNoOU1WCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
    server: https://127.0.0.1:59623
  name: kind-kind
contexts:
- context:
    cluster: kubernetes
    user: kubernetes-admin
  name: kubernetes-admin@kubernetes
- context:
    cluster: kind-kind
    user: kind-kind
  name: kind-kind
current-context: kind-kind
kind: Config
preferences: {}
users:
- name: kubernetes-admin
  user:
    client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURJVENDQWdtZ0F3SUJBZ0lJR3VmQ1haOEJYNzR3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBNU16QXdPREEyTWpkYUZ3MHlOVEE1TXpBd09ERXhNekZhTURReApGekFWQmdOVkJBb1REbk41YzNSbGJUcHRZWE4wWlhKek1Sa3dGd1lEVlFRREV4QnJkV0psY201bGRHVnpMV0ZrCmJXbHVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQXlFdmFXMURaTkpHUE01ZkMKb1E4Wnplb0I2Nm5DQ3J3VndpM3I4blJwZG5WY0xBNGdNWVlXZnVtWm5IMEgxWEplUmdtanhGYUVDUDM1aEtQegphLzZMSDkvTnkrK2NJZXFGc1Q3NVZ2bGc3NWZVQ0Fvd0VoU3JQSHVZSDllTUVKRlV1d2xkcmZUdGxQaVFoM0MwCnhxd2lORkVSbXRmTnIrWjJTeXFLczAydmFtOWpuZW5Jdk90MzJMdWFmVWxwUHdGaGR0bkwrdTI3WXJVcTVSZDEKazhxSTBuS0NJdTVQeGxORUlyQnpEN29SbldRZEt1U0tyZFQyemI0dHdjRWlDckpLRzMwQVRZbjFOcGF5RW03egpZVkdTbjRhOFRCV1AzSUxpWDZhYjkwbEVWTGU3b3J2dmVrbTFlbzA0eDZoRWJETHlkaTg4amFsZnRjcjBqK1hlCkw1RS9hUUlEQVFBQm8xWXdWREFPQmdOVkhROEJBZjhFQkFNQ0JhQXdFd1lEVlIwbEJBd3dDZ1lJS3dZQkJRVUgKQXdJd0RBWURWUjBUQVFIL0JBSXdBREFmQmdOVkhTTUVHREFXZ0JReUp2SWYremlBQ0xlYzZlU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UtCZ1FES1FkSzhFalFKc3lWTUJ1ZmlJdGdaalVZK0h3YUFoMC9NeHNvZmxHYWJiUkNnckdFaUpwRmkKYVc0Y1M2dUV1SVlDcStZRVo5b3FJOHd2WUlMOGU0bGwwV1BCTDQwL2pqZFkrSmVzYmNmbmIxMW5vVCtOUXdqSQpYdWh1VER4WDBuVjJXNGE4Ni9vaUtQQnh1ZmFwSEhrWGRTckJjYmcyODFQRTJZd1VLYVQzWVE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
`,
			ActionTimeoutSeconds: 30,
		},
	}

	// 插入mock数据
	for _, cluster := range clusters {
		if err := m.db.Create(&cluster).Error; err != nil {
			log.Printf("populateMockData: 插入 K8sCluster 失败: %v\n", err)
			continue
		}
		log.Printf("populateMockData: 初始化 Kubernetes 集群成功，ClusterID: %d\n", cluster.ID)
	}
}
